package com.fbs.job.admin.mapper;


import com.fbs.job.admin.core.entity.FbsJobLog;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
* 描述： Mapper
* @author wwd
* @date 2024-02-04 12:39:28
*/
@Mapper
public interface FbsJobLogMapper  {

    long save(FbsJobLog jobLog);

    List<Long> findLostJobIds(@Param("losedTime") Date losedTime);

    int updateHandleInfo(FbsJobLog fbsJobLog);

    FbsJobLog getById(@Param("id")long id);

    int updateTriggerInfo(FbsJobLog jobLog);

    List<FbsJobLog> pageList(@Param("offset") int offset,
                                    @Param("pagesize") int pagesize,
                                    @Param("jobActuator") int jobActuator,
                                    @Param("jobId") int jobId,
                                    @Param("triggerTimeStart") Date triggerTimeStart,
                                    @Param("triggerTimeEnd") Date triggerTimeEnd,
                                    @Param("logStatus") int logStatus);

    int pageListCount(@Param("offset") int offset,
                      @Param("pagesize") int pagesize,
                      @Param("jobActuator") int jobActuator,
                      @Param("jobId") int jobId,
                      @Param("triggerTimeStart") Date triggerTimeStart,
                      @Param("triggerTimeEnd") Date triggerTimeEnd,
                      @Param("logStatus") int logStatus);

    List<Long> findFailJobLogIds(@Param("pagesize") int pagesize);

    int updateAlarmStatus(@Param("logId") long logId,
                                 @Param("oldAlarmStatus") int oldAlarmStatus,
                                 @Param("newAlarmStatus") int newAlarmStatus);

    Map<String, Object> findLogReport(@Param("from") Date from,
                                      @Param("to") Date to);

    List<Long> findClearLogIds(@Param("jobActuator") int jobActuator,
                                      @Param("jobId") int jobId,
                                      @Param("clearBeforeTime") Date clearBeforeTime,
                                      @Param("clearBeforeNum") int clearBeforeNum,
                                      @Param("pagesize") int pagesize);

    int clearLog(@Param("logIds")List<Long> logIds);

    int deleteByJobId(@Param("jobId") int jobId);
}
